<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<title>Home</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="Motel Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
	<script type="applijewelleryion/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<link th:href="@{/css/bootstrap.css}" rel='stylesheet' type='text/css' />
	<!-- Custom Theme files -->
	<link th:href="@{/css/style.css}" rel='stylesheet' type='text/css' />
	<link th:href="@{/css/buttons.css}" rel='stylesheet' type='text/css' />


	<link th:href="@{/css/layui.css}" rel='stylesheet' type='text/css' />

	<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
	<script src="http://how2j.cn/study/js/bootstrap/3.3.6/bootstrap.min.js"></script>

	<script th:src="@{/js/jquery-1.11.1.min.js}"></script>
	<!--webfonts-->
	<link href='http://fonts.useso.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
	<link href='http://fonts.useso.com/css?family=Open+Sans:400,300italic,300,600' rel='stylesheet' type='text/css'>
	<!--//webfonts-->
	<script type="text/javascript" >//th:src="@{/js/bootstrap.js}"
	var date = new Date();
	var month=date .getMonth()+1;
	var DAY;
	if (date .getDate()<10)
		DAY="0"+date .getDate();
	else
		DAY=date.getDate();
	var DATE=month+"/"+DAY+"/"+date .getFullYear();

	function submits() {
		var text1=document.getElementById("param").value;
		var text2=document.getElementById("datepicker").value;
		var text3=document.getElementById("datepicker1").value;


		if(text1!=""){
			if (text2!="预计入住时间"&&text2!="")//||
				if (text3!="预计离店时间"&&text3!=""){//||
					if (text2<DATE||text2>=text3)
						alert("请确认日期是否正确")
					else {
						var from1data = $("#SearchText").serialize();
						var from2data = $("#In").serialize();
						var from3data = $("#Out").serialize();
						var data=from1data+'&'+from2data+'&'+from3data;///////
						$.ajax({
							//几个参数需要注意一下
							type: "POST",//方法类型
							dataType: "json",//预期服务器返回的数据类型
							url: "/index2" ,//url
							data: data,
							success: function (result) {
								console.log(result);//打印服务端返回的数据(调试用)
								if (result.resultCode == 200) {
									window.location.href="/index2"
								}
								;
							},
							error : function() {
								window.location.href="/select"
							}
						});
					}

				}else {
					alert("请选择预计离店时间");
				}
			else {
				alert("请选择预计入住时间");
			}

		}else
		{ alert("请输入酒店、城市或品牌等关键字"); }

	}


	var cookies=new Array();
	var f;
	function selectcookie(name) {

		cookies[0]=document.cookie.split(";")[0];
		cookies[1]=document.cookie.split(";")[1];
		//	alert("cookies的值"+cookies[0]+cookies[1]);
		//alert("找"+name);
		for (var i=0;i<2;i++){
			if(cookies[i].trim()==name.trim())
			{
				//alert("找到"+name+i+"返回"+cookies[i]);
				f=i;
				return cookies[i];
			}
		}
		if (i==2)
		{
			//	alert("未找到");
			return "false";
		}
	}
	function updatacookie(name,newname) {
		//	alert("更新"+name+"为"+newname);
		selectcookie(name);
		if (f==0)
		{
			//	alert("0");
			//alert(newname);
			var date=new Date();
			//将date设置为过去的时间
			// date.setTime(date.getTime()-10000);
			//将userId这个cookie删除
			document.cookie=newname+"; expire="+date.toGMTString()+"path=/";
			document.cookie=newname+";"+document.cookie.split(";")[1];
			//alert("完成更新"+document.cookie)
		}
		else
		{
			//	alert("1");
			//	alert(newname);
			//获取当前时间
			var date=new Date();
			//  //将date设置为过去的时间
			// date.setTime(date.getTime()-10000);
			//将userId这个cookie删除
			document.cookie=newname+"; expire="+date.toGMTString()+"path=/";
			document.cookie=document.cookie.split(";")[0]+";"+newname;
			//alert("完成更新"+document.cookie)
		}

	}
	function HeatSort() {
		if (selectcookie("h_flag=true").trim()=="h_flag=true".trim()){
			//alert("热度高到低");
			window.location.href="/HeatSortDes";
			//alert(document.cookie.split(";")[0]);
			updatacookie("h_flag=true","h_flag=false");
			//document.getElementById("heat").value="热度从低到高";
		}
		else {
			//	alert("热度低到高");
			window.location.href="/HeatSortAsc";
			//	alert(document.cookie.split(";")[0]);
			updatacookie("h_flag=false","h_flag=true");
			document.getElementById("heat").value="热度从高到低";
		}
	}


	function PriceSort() {
		//	alert("->");
		if (selectcookie("p_flag=true").trim()=="p_flag=true".trim()){
			window.location.href="/PriceSortAsc";
			updatacookie("p_flag=true","p_flag=false");
		}
		else {
			//	alert("高to低");
			window.location.href="/PriceSortDes";
			updatacookie("p_flag=false","p_flag=true");
		}
	}

	</script>
</head>
<body>
<!-- banner -->
<div th:replace="~{include/search::search}">

</div>
<!-- banner -->
<!-- hod -->

<!-- hod -->
<div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >企业网站模板</a></div>
<!-- tels -->
<div class="container">
	<div class="button-group btn-group">
		<button class="button button-royal button-rounded button-raised" type="button" disabled="">排序方式</button>
		<button class="button button-royal button-rounded button-raised" type="button" onclick="PriceSort()" id="price" th:text="${P_Text}">价格从低到高</button>
		<button class="button button-royal button-rounded button-raised" type="button" onclick="HeatSort()" id="heat" th:text="${H_Text}">热度从高到底</button>
	</div>
	&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
	<button class="button button-royal button-rounded button-raised" type="button" disabled="">筛选</button>
	<div class="btn-group">
		<button type="button" class="btn btn-primary dropdown-toggle "  data-toggle="dropdown" >
			价格
			<span class="caret"></span>
		</button>
			<ul class="dropdown-menu" role="menu" id="screenprice" >
				<li style="text-align: center">
					<h5>请设置您的预算，亲</h5>
				</li>
				<li>
					<br/>
				</li>
				<li role="presentation" style="height: 15px" >
                    <div>
                        <div class="demo-slider" id="slideTest10"></div>
                    </div>
				</li>
                <li style="text-align: center">
                    <span> <button type="button" class="btn btn-primary dropdown-toggle " onmouseup="mUp('6')">确认</button></span>
                </li>
			</ul>

	</div>
	<div class="btn-group">
		<form>
		<button type="button" class="btn btn-primary dropdown-toggle "  data-toggle="dropdown">
			等级
			<span class="caret"></span>
		</button>
		<ul class="dropdown-menu" role="menu">
			<li>
				<a href="#">酒店等级</a>
			</li>
			<li role="presentation">
<!--				<input type="checkbox" value="五星" onmousedown="mDown()" checked/>-->
				<a th:href="|/screen?start=${start}&end=${end}&star=5|"><input type="checkbox" onmouseup="mUp('5')" th:checked="${star5}"/>五星</a>
			</li>

			<li role="presentation">
				<a th:href="|/screen?start=${start}&end=${end}&star=4|"><input type="checkbox" onmouseup="mUp('4')" th:checked="${star4}"/>四星</a>
			</li>
			<li role="presentation">
				<a th:href="|/screen?start=${start}&end=${end}&star=3|"><input type="checkbox" onmouseup="mUp('3')" th:checked="${star3}"/>三星</a>
			</li>
			<li role="presentation">
				<a th:href="|/screen?start=${start}&end=${end}&star=2|"><input type="checkbox" onmouseup="mUp('2')" th:checked="${star2}"/>二星</a>
			</li>
			<li role="presentation">
				<a th:href="|/screen?start=${start}&end=${end}&star=1|"><input type="checkbox" onmouseup="mUp('1')" th:checked="${star1}"/>一星</a>
			</li>
			<li role="presentation">
				<a th:href="|/screen?start=${start}&end=${end}&star=0|"><input type="checkbox" onmouseup="mUp('0')" th:checked="${star0}"/>其他</a>
			</li>
		</ul>
			</form>
	</div>

</div>



<div th:replace="~{include/hotels::hotels}">
</div>

<!-- tels -->
<!-- special -->
<!-- special -->
<!-- quick -->
<!-- quick -->
<!-- footer -->
<div class="footer">
	<div class="container">
		<div class="col-md-2 deco">
			<h4>导航</h4>
			<li><a th:href="@{/}">主页</a></li>
			<li><a th:href="@{/shortcodes.html}">短信通知</a></li>
			<li><a th:href="@{/sigin.html}">登录</a></li>
			<li><a th:href="@{/contact.html}">相关联系</a></li>
		</div>
		<div class="col-md-2 deco">
			<h4>链接</h4>
			<li><a href="#">关于我们</a></li>
			<li><a href="#">法律支持</a></li>
			<li><a href="#">用户须知</a></li>
		</div>
		<div class="col-md-2 deco">
			<h4>社交软件</h4>
			<div class="soci">
				<li><a href="#"><i class="f-1"> </i></a></li>
				<li><a href="#"><i class="t-1"> </i></a></li>
				<li><a href="#"><i class="g-1"> </i></a></li>
			</div>
		</div>
		<div class="col-md-3 cardss">
			<h4>安全支付</h4>
            <li><i class="WeChatPay"></i></li>
            <li><i class="Alipay"></i></li>
            <li><i class="UnionPay"></i></li>
			<div class="clearfix"> </div>
		</div>
		<div class="col-md-3 pos">
			<h4>实时通知</h4>
			<form method="post">
				<input type="text" class="textbox" value="E-mail" onFocus="this.value = '';" onBlur="if (this.value == '') {this.value = 'Email';}">
				<div class="smt">
					<input type="submit" value="订阅">
				</div>
			</form>
		</div>
		<div class="clearfix"> </div>
	</div>
</div>
<div class="footer-bottom">
	<div class="container">
		<p>Copyright &copy; 2015.Company name All rights reserved.More Templates <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a>
		</p>
	</div>
</div>


<script th:src="@{/layui/layui.js}" charset="utf-8" ></script>
<!-- footer -->
<script>
    //var ul = document.querySelector('ul');

	var start=[[${start}]];
	var end=[[${end}]];
	var star="6";
	if ([[${star}]]!="6")
     star=[[${star}]];

    function mUp(i){
        // window.location='/screen?'+'start='+start+'&end='+end+'&star='+star;
		//window.location.assign("/screen?"+"start="+start+"&end="+end+"&star="+star)
		switch (i) {
			case "6":star="6";break;
			case "5":star="5";break;
			case "4":star="4";break;
			case "3":star="3";break;
			case "2":star="2";break;
			case "1":star="1";break;
			case "0":star="0";break;
		}
		document.write("<form action=/screen method=post name=form1 style='display:none'>");
		document.write("<input type=hidden name=start value='"+start+"'>");
		document.write("<input type=hidden name=end value='"+end+"'>");
		document.write("<input type=hidden name=star value='"+star+"'>");
		document.write("</form>");
		document.form1.submit();
	}
	layui.use('slider', function(){
		var $ = layui.$
				,slider = layui.slider;

		//开启范围选择
		slider.render({
			elem: '#slideTest9'
			,value: 40 //初始值
			,range: true //范围选择
			,change: function(vals){
				$('#test-slider-tips2').html('开始值：'+ vals[0] + '、结尾值：'+ vals[1]);
			}
		});
		slider.render({
			elem: '#slideTest10'
			,value: [start, end] //初始值
			,range: true //范围选择
            ,min: 0 //最小值
            ,max: 1100
            ,step: 30 //步长
			,change: function(vals){
				// setTimeout(function(){
				// 	window.location='/screen?'+'start='+vals[0]+'&end='+vals[1];
				// },1500)
                start=vals[0];
                end=vals[1];

			}
		});
	});
</script>
</body>
</html>